package com.abso.sunlight.explorer.expressions;

import org.eclipse.core.expressions.PropertyTester;

import com.abso.sunlight.explorer.viewers.ExplorerTreeNode;

/**
 * A property tester checking the node type of a specific tree node.
 */
public class ExplorerTreeNodePropertyTester extends PropertyTester {

    /* (non-Javadoc)
     * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
     */
    public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
        ExplorerTreeNode node = (ExplorerTreeNode) receiver;
        if ("explorerTreeNodeType".equals(property)) {
            return node.getType().name().equals(expectedValue);
        } else {
            return false;
        }
    }

}
